import ContinuousScroll from './ContinuousScroll';
import SingleStepScroll from './SingleStepScroll';

export default {
  props: Object.assign({}, ContinuousScroll.props, SingleStepScroll.props, {
    mode: {
      type: String,
      default: 'continuous',
      validator: (v) => ['continuous', 'singleStep'].includes(v),
    },
  }),
  render(h) {
    if (!this.dataList || !this.dataList.length) {
      return h('div', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }, [
        this.$slots.empty ? this.$slots.empty : h('div'),
      ]);
    }
    return h(this.mode === 'continuous' ? ContinuousScroll : SingleStepScroll, {
      props: this.$props,
      scopedSlots: {
        default: (props) => this.$slots.default && this.$slots.default(props),
      },
    });
  },
};
